package colbert.content.singleton;

public class HungrySingleton {
    private static final HungrySingleton instance = new HungrySingleton();
    private HungrySingleton(){
        if(instance != null){
            throw new RuntimeException("单例对象不能被实例化");
        }
    }
    public static synchronized HungrySingleton getInstance(){
        System.out.println("获取饿汉单例对象");
       return instance;
    }

}
